package zhupf.test.threadTest;

import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

class FutureCallable implements Callable<Integer> {

    @Override
    public Integer call() throws Exception {
        System.out.println("wellcome to callable method");
        return 1024;
    }
}
public class FutureTaskDemo {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        FutureTask<Integer> futureTask = new FutureTask<>(new FutureCallable());
        new Thread(futureTask,"A").start();
        System.out.println(futureTask.get());
    }
}
